<?php
// 应用公共文件

/**
 * 通用化API格式输出
 * @param $status
 * @param $message
 * @param $data
 * @param $httpStatus
 * @return \think\response\Json
 * User: xyb
 * Date: 2022/11/2 19:27
 */
function show($status, $message = 'error', $data = [], $httpStatus = 200)
{
    $result = [
        'status' => $status,
        'message' => $message,
        'result' => $data
    ];
    return json($result, $httpStatus);
}

function showJson($status, $data = [], $code = 200)
{
    $result = [
        'code' => $status,
        'data' => $data
    ];
    return json($result, $code);
}
